wifi-scripts: ucode: improve formatting of expected throughput
authorRany Hany <[email protected]>
Mon, 27 Oct 2025 16:14:22 +0000 (16:14 +0000)
committerRobert Marko <[email protected]>
Mon, 15 Dec 2025 11:39:14 +0000 (12:39 +0100)
Convert to MBit/s like all other fields and specify the unit.
Most users probably aren't aware that this is in kilobits/s.

Signed-off-by: Rany Hany <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/20567
Signed-off-by: Robert Marko <[email protected]>
package/network/config/wifi-scripts/files-ucode/usr/bin/iwinfo
package/network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc

index a1290ac20163cae631a28062551cf67020dd9cd8..d36268b06e96c9c6a4e08957d65260742facb97a 100755 (executable)
@@ -25,7 +25,8 @@ function print_assoclist(stations) {
                                printf(', %s', flags);
                        printf('%10d Pkts.\n', bitrate.packets);
                }
-               printf(`\texpected throughput: ${station.expected_throughput}\n\n`);
+               let expected_throughput = station.expected_throughput;
+               printf(`\texpected throughput: ${expected_throughput == 'unknown' ? 'unknown' : expected_throughput + ' MBit/s'}\n\n`);
        }
 }
 
index 21244089ab84c37f4b26046febdb0594dc309805..b2eb8cfd10343b97b3b3e6607a30dd58b0ab7ccf 100644 (file)
@@ -169,6 +169,10 @@ function format_rate(rate) {
        return rate ? sprintf('%.01f', rate / 10.0) : 'unknown';
 }
 
+function format_expected_throughput(rate) {
+       return rate ? sprintf('%.01f', rate / 1000.0) : 'unknown';
+}
+
 function format_mgmt_key(key) {
        switch(+key) {
        case 1:
@@ -352,7 +356,7 @@ export function assoclist(dev) {
                                packets: station.sta_info.tx_packets ?? 0,
                                flags: assoc_flags(station.sta_info.tx_bitrate ?? {}),
                        },
-                       expected_throughput: station.sta_info.expected_throughput ?? 'unknown',
+                       expected_throughput: format_expected_throughput(station.sta_info.expected_throughput ?? 0),
                };
                ret[sta.mac] = sta;
        }